USE [WGRUS-phone]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER dbo.CustomerEventTrigger 
   ON  dbo.Customer 
   AFTER INSERT, UPDATE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	INSERT INTO dbo.CustomerEvent
	([TelefonNr],[Navn],[Gade],[PostNr],[By],[Oprettet],[Email],[Source], [EVENT])
	SELECT 
	[TelefonNr],[Navn],[Gade],[PostNr],[By],[Oprettet],[Email],[Source],'INSERT' AS [Event]
	FROM INSERTED;
END
GO

